package com.zj.viewpagerdemo.view;

import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.TableLayout;

import com.zj.viewpagerdemo.R;
import com.zj.viewpagerdemo.adapter.Main2Adapter;
import com.zj.viewpagerdemo.mvp.Main2Contract;
import com.zj.viewpagerdemo.mvp.Main2Presenter;

public class Main2Activity extends AppCompatActivity implements Main2Contract.View {

    private TabLayout tabLayout;
    private ViewPager viewPager;

    private Main2Contract.Presenter presenter;
    private Main2Adapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);

        new Main2Presenter(this);
    }

    @Override
    public void setPresenter(Main2Contract.Presenter presenter) {
        this.presenter = presenter;
    }

    @Override
    public void initViews() {
        tabLayout = (TabLayout) findViewById(R.id.tab_layout);
        viewPager = (ViewPager) findViewById(R.id.view_pager);

        adapter = new Main2Adapter(this, getSupportFragmentManager());
        viewPager.setAdapter(adapter);

        tabLayout.setupWithViewPager(viewPager);
        tabLayout.setTabMode(TabLayout.MODE_FIXED);
    }

    @Override
    public void onLoading(String text) {

    }

    @Override
    public void loadingComplete() {

    }

    @Override
    public void loadingError(String error) {

    }
}
